價格:免費
更新日期:2017-10-11
檔案大小:749k
目前版本:1.0
版本需求:Android 4.0 以上版本
官方網站:mailto:sterlingann@gmail.com
I want my app to display a 3d cube which retains its orientation (displays same side / vertices to viewer), regardless of the devices orientation. How does one go about conquering such an impressive feat of engineering?
This can accomplished by utilizing the Android sensors the access readings from device's accelerometer and magnetometer. We tell the manifest that we are going to handle configuration changes by ourselves and then compute the orientation by monitoring the position of the device relative to the earth's frame of reference! What if I want to also maintain my current view if I rotate my device along the Z-axis? The position sensor makes it possible.
Awesome! But how can the user ascertain that the re-orientation of the cube face displayed is the bonafide original? To illustrate this I have enabled onTouch events. The user can dynamically rotate the cube along the axis in any direction by moving their finger back and forth - from the gradual shift of vertices its obvious that nothing is being destroyed and recreated. By contrast, a full blown orientation change can be achieved by fully rotating the phone in both clockwise and counter-clockwise along the X/Y/Z planes.
Features:
1.) Zoom in and out by clicking the top portion of the screen
2.) Adjust lighting by clicking the bottom portion of the screen
3.) Rotate the cube with your finger to see my cat using its favorite app, my favorite type of fish etc.
4.) Change orientation by rotating the device itself along the X/Y/Z planes.